<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="/pages/error.jsp" import="app.engine.solucoes.request.beans.*, java.util.*"%>
	<jsp:useBean id="usuario" class="app.engine.solucoes.request.beans.Usuario" scope="session" />
	<jsp:useBean id="pergunta" class="app.engine.solucoes.request.beans.Pergunta" scope="request" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<script type="text/javascript" src="/javascript/script.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><%=usuario.getNomeUsuario() != null ? usuario.getNomeUsuario() : "" %> - [Adicição de uma FAQ]</title>
</head>
<body onload="tringTextArea();">
<%
	if (usuario.getId() == null)
		response.sendRedirect("/");
%>
	<% List<Resposta> respostas = (List<Resposta>) request.getSession().getAttribute("respostas"); %>
	<form name="menu" action="faqtool" method="post">
		<input type="hidden" name="cmd" value="">
		<input type="hidden" name="txtPergunta" value="<%=request.getAttribute("txtPergunta") %>">
		<table border="1" align="center">
			<tr>
				<td>
				<table bgcolor="tan" border="0" align="center" cellpadding="10"
					cellspacing="0">
					<tr>
						<th colspan="2">FAQ - Frequently Asked Questions</th>
					</tr>
					<tr>
						<td><b>Pergunta:</b></td>
						<td><input type="text" name="pergunta" size="46" readonly="readonly" value="<%=pergunta.getTxtPergunta() %>"></td>
					</tr>
					<% 	int i = 0;
						for(Resposta resposta : respostas) { %>
							<%i++;%>
						<tr>
							<td>
								<b>Resposta <%= i%>:</b>
							</td>
							<td>
								<textarea name="resposta:<%= resposta.getId() %>" cols="35" rows="5" readonly="readonly" >
				      				<%= resposta.getTxtResposta() %>
				     			</textarea>
				     		</td>
						</tr>
						
              		<% } %>
					<tr>
						<td colspan="2" align="center">
							<input type="submit" value="Voltar" onClick="document.menu.cmd.value='do-list-faq'"/>
							<input type="submit" value="Menu Principal" onClick="document.menu.cmd.value='main-menu'"/>
							<input type="submit" value="Sair" onClick="setCmd('exit')" />
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
